<template>
  <div>
    <header>
      <router-link to="/">首页</router-link>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
      <router-link to="/news">新闻</router-link>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
      <router-link to="/course">课程</router-link>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
      <router-link to="/video">视频</router-link>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
      <router-link to="/book">书籍</router-link>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
      <router-link to="/user">用户首页</router-link>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
      <router-link to="/login">登录</router-link>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

      <button @click="goto">前进</button>&nbsp;&nbsp;
      <button @click="backto">后退</button>

      <input type="text" v-model="num">
      <button @click="gotonums">指定</button>
    </header>
    <article>
      <router-view></router-view>
    </article>
  </div>
</template>

<script>
export default {
  name: 'App',
  components: {},
  data() {
    return {
      num: 1
    }
  },
  methods: {
    goto() {
      this.$router.go(1)
    },
    backto() {
      this.$router.go(-1);
    },
    gotonums(){
      this.$router.go(this.num)
    }
  }
}

</script>

<style>
#app {
  font-family: Avenir, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: #2c3e50;
  margin-top: 60px;
}
</style>
